package cn.qy.java.base.ch22;

/**
 * 研究 for 循环
 */
public class LoopTest {

    static final int[] ARRAY = {1, 2, 3, 4, 5, 6, 7, 8};

    /**
     * 每一批的读取量
     */
    private static final int PER_SIZE = 5;

    public static void main(String[] args) {
        int used = 0;
        while (used < ARRAY.length) {
            int step = Math.min(ARRAY.length - used, PER_SIZE);
            // 按批读取
            for (int j = used; j < used + step; j++) {
                System.out.println(ARRAY[j]);
            }
            used += step;
        }
    }
}
